How to: Specify a sort order for a query.
Solution:
In the Query Design view, arrange the fields in the design grid in the desired sort order; then select 'Ascending', 'Descending', or '(not sorted)' from the 'Sort' drop-down list for the desired fields.
1) Make sure the query is open in the Design view.
NOTE: If the Database window is not active, activate the Database window.
2) Arrange the fields in the design grid in the desired order that the sort will be performed:
NOTE: The query is sorted on each field in the order that the fields appear in the design grid, from left to right.
a) Select the desired column to move:
1] Place the cursor above the column. (The cursor changes to a down arrow.)
2] Click the mouse button. (The entire field column is highlighted.)
b) Select the 'Edit' menu and select 'Cut'. (The field column is deleted and copied to the Clipboard.)
c) If necessary, insert a new column where the deleted column is to appear:
1] Click in the column to the left of where the new column is to be.
2] Select the 'Insert' menu and select 'Column'. (A new column is inserted to the left of the column clicked.)
d) Select the column to which to move the deleted column:
1] Place the cursor above the column. (The cursor changes to a down arrow.)
2] Click the mouse button. (The entire field column is highlighted.)
e) Select the 'Edit' menu and select 'Cut'. (The deleted field column is pasted from the Clipboard to the selected column.)
f) Repeat steps 2)a) through 2)e) to move the field columns around until they are in the desired order.
3) Click in the 'Sort' row for the field to sort. (A down arrow appears.)
4) Click on the arrow. (A drop-down list appears.)
5) Select 'Ascending', 'Descending', or '(not sorted)' from the 'Sort' drop-down list.
6) Repeat steps 3) through 5) for each field to sort.
7) To view the results of the sort, select the 'View' menu and select 'Datasheet'.
8) To run the query:
a) Make sure Query Design view is open.
NOTE: If Datasheet view is open, select the 'View' menu and select 'Query Design'.
b) Select the 'Query' menu and select 'Run'.
9) To save the query with the new sort order, select the 'File' menu and select 'Save'. (If the query was an existing query, the query is saved. If the query was just created query, the Save As dialog box appears.)
10) If the 'Save As' dialog box appears:
a) Type a name for the query in the 'Query Name' box.
b) Click 'OK'. (The new query is saved.)
11) Select the 'File' menu and select 'Close' to close the Query Design view.